var status = 0;
var eff = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#";
var z = "#fEffect/CharacterEff/1112960/3/0#"; //"+z+"//美化
var zz = "#fUI/UIPVP.img/ChampionMark/4#"; //
var kkk1 = "#fMap/MapHelper.img/weather/thankyou/7#";
var kkk2 = "#fMap/MapHelper.img/weather/starPlanet2/8#";
var kkkk = "#fUI/UIPVP.img/MiniMapIcon/star#"; //小黄心
var BOSS = "#fUI/UIWindow2/MobGage/SmartMobnotice/backgrnd#";
var eff1 = "#fEffect/CharacterEff/1112905/0/1#"; //小红心
var icon = "#fUI/Basic.img/BtMin2/normal/0#";
var iconEvent = "#fUI/UIToolTip.img/Item/Equip/Star/Star#";
var ttt = "#fUI/UIWindow/Quest/icon2/7#"; //"+ttt+"//美化1
var ttt2 = "#fUI/UIWindow/Quest/icon6/7#"; ////美化2
var ttt3 = "#fUI/UIWindow/Quest/icon3/6#"; //"+ttt3+"//美化圆
var ttt4 = "#fUI/UIWindow/Quest/icon5/1#"; //"+ttt4+"//美化New
var ttt5 = "#fUI/UIWindow/Quest/icon0#"; ////美化!
var ttt6 = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#"; //"+ttt6+"//美化会员
var z1 = "#fUI/UIWindow.img/PvP/Scroll/enabled/next2#"; //"+z+"//美化
var tt = "#fEffect/ItemEff/1112811/0/0#"; //音符
var a = "#fEffect/CharacterEff/1114000/1/0#"; //红色六芒星
var b = "#fEffect/CharacterEff/1003271/0/0#";
var c = "#fEffect/CharacterEff/1112905/0/0#"; //篮心
var d = "#fEffect/CharacterEff/1002667/0/0#"; //黄星
var e = "#fUI/UIPVP.img/MiniMapIcon/star#"; //音乐
var g = "#fEffect/CharacterEff/1082565/0/0#"; //饼干兔子
var h = "#fUI/Basic/BtHide3/mouseOver/0#";
var f = "#fUI/UIPVP.img/MiniMapIcon/star#"; //彩色五角星
var feng = "#v4032733#"
var sss = "#fEffect/BasicEff.img/JobChangedElf/13#"; ////双弩女王图标
var bobo1 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/0#"; //迷你笑脸
var bobo2 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/1#"; //迷你愁脸
var bobo3 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Basic/2#"; //迷你开心
var bobo4 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/0#"; //迷你生气
var bobo5 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/1#"; //迷你猥琐笑
var bobo6 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/2#"; //迷你闭嘴
var bobo7 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/3#"; //迷你开怀大笑
var bobo8 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/4#"; //迷你目瞪口呆
var bobo9 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/5#"; //迷你哭泣
var bobo10 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/6#"; //迷你凶恶
var bobo11 = "#fUI/GuildBBS.img/GuildBBS/Emoticon/Cash/7#"; //迷你惊吓
var kkk = "#fUI/UIWindow2.img/AttackRangking/1#"; //小皇冠
var ob13 = "#fUI/UIWindow2.img/CN_Santa/backgrnd#"; //长条
var F118 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/0#"; //迷你女皇
var F119 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/1#"; //迷你女皇
var F120 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/2#"; //迷你女皇
var F121 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/3#"; //迷你女皇
var F122 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/4#"; //迷你女皇
var F123 = "#fUI/UIWindow4.img/bossArena/mainUi/bossIcon/5#"; //迷你女皇
var ob6 = "#fEffect/SetEff.img/181/effect/walk1/2#"; //狗拉车
function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (status == 0 && mode == 0) {
		cm.dispose();
		return;
	}
	if (mode == 1) {
		status++;
	} else {
		status--;
	}
	if (cm.getMapId() == 180000001) {
		cm.sendOk("很遗憾，您因为违反用户守则被禁止游戏活动，如有异议请联系管理员.")
		cm.dispose();
	} else if (status == 0) { //
		//补充拍卖出券
		if (!cm.haveItem(2432022)) {
			cm.gainItem(2432022, 1);
			cm.playerMessage("已补充拍卖券，放在快捷键可快速打开拍卖中心~");
		}
		var selStr = "     " + ob6 + "\r\n";
		selStr += "#r#L0#" + bobo1 + " #e自由市场#l  " + (cm.isQuestFinished(1465) ? "#L1#" + bobo1 + " 五转中心#l" : "#L1#" + bobo1 + " 转职中心#l") + "  #L2#" + bobo1 + " 个人信息#l#k\r\n";
		selStr += "\r\n#d#L3#" + bobo3 + " 万能传送#l  #L4#" + bobo3 + " PPMS副本#l  #L5#" + bobo3 + " 全服商店#l#k\r\n";
		selStr += "\r\n#b#L6#" + bobo7 + " 每日福利#l  #L7#" + bobo7 + " 材料冶炼#l  #L8#" + bobo7 + " 待完善#l#k\r\n";
		selStr += "\r\n#r#L9#" + bobo5 + " 免费会员#l  #L10#" + bobo8 + " 学习技能#l  #L11#" + bobo5 + " 个人乱斗#l#k\r\n";
		selStr += "\r\n#d#L12#" + bobo11 + " 怪怪图鉴#l  #L13#" + bobo11 + " 神秘徽章#l  #L14#" + bobo5 + " 金币兑换#l#k\r\n";
		selStr += "\r\n#b#L15#" + bobo2 + " 进入商城#l  #L16#" + bobo9 + " 拓展功能#l  #L17#" + bobo9 + " 掉落查询#l#k\r\n\r\n";
		selStr += " 	          #k\r\n";
		cm.sendSimple(selStr);
	} else if (status == 1) {
		switch (selection) {
			case 0: // 自由市场
				if (cm.getPlayer().getMapId() >= 910000000 && cm.getPlayer().getMapId() <= 910000022) {
					cm.sendOk("你已经在自由市场了。");
				} else {
					cm.saveReturnLocation("FREE_MARKET");
					cm.warp(910000000, "st00");
				}
				cm.dispose();
				break;
			case 1: // 快速转职
				cm.dispose();
				cm.openNpc(9310362, "转职中心");
				break;
			case 2: // 个人信息
				cm.dispose();
				cm.openNpc(2140003, "个人信息");
				break;
			case 3: //地图传送
				cm.dispose();
				cm.openNpc(9201555, "地图传送");
				break;
			case 4: //BOSS传送
				cm.dispose();
				cm.openNpc(2140003, "BOSS传送");
				break;
			case 5: //全服商店
				cm.dispose();
				cm.openNpc(1052014);
				break
			case 6: //  福利中心
				cm.dispose();
				cm.openNpc(9000232, "福利中心");
				break;
			case 7:
				cm.dispose();
				cm.openNpc(9130115);
				break;
			case 8:
				cm.dispose();
				// cm.openNpc(1203000, "制作装备列表");
				cm.sendOk("待完善");
				break;
			case 9:
				cm.dispose();
				cm.openNpc(1530256, "免费会员");
				break;
			case 10: //  技能学习中心
				cm.dispose();
				cm.openNpc(9000192, "技能学习");
				break;
			case 11: // 
				cm.dispose();
				cm.openNpc(9070003, "个人乱斗");
				break;
			case 12: // 怪怪图鉴
				cm.dispose();
				cm.openUI(596);
				break;
			case 13: //  神秘徽章
				cm.dispose();
				cm.openNpc(9900003, "神秘徽章");
				break;
			case 14: 
				cm.sendOk("待完善");
				// cm.openNpc(9000194, "强化装备");
				break;
			case 15:
				cm.dispose();
				cm.enterCS();
				break;
			case 16: //  拓展功能
				cm.dispose();
				cm.openNpc(9000084, "拓展功能");
				break;

			case 17: //  掉落查询
				cm.dispose();
				cm.openNpc(9310362, "掉落查询");
				break;
			case 89: // 装备分解——目前没加
				cm.dispose();
				cm.openNpc(9310362, "装备分解");
				break;
		}
	}
}